#include<iostream>
#include"ThreadPool.hpp"
#include"Task.hpp"
#include<ctime>
//线程池
int main()
{
    //ThreadPool<Task>* tq=new ThreadPool<Task>(5);
    ThreadPool<Task>::GetInstance()->Start();
    //tq->Start();
    //构建任务
    srand(time(nullptr)^getpid());
    //交给线程池处理
    while(true)
    {
        int x=rand()%10+1;
        usleep(10);
        int y=rand()%5;
        char op=opers[rand()%opers.size()];
        Task t(x,y,op);

        ThreadPool<Task>::GetInstance()->Push(t);
        //tq->Push(t);   
        std::cout<<"main thread get task:"<<t.GetTask()<<std::endl;
        sleep(1);
    }

}